package cn.humaohua.study.yanmo_design_pattern.ch14.v3;

import cn.humaohua.study.yanmo_design_pattern.ch14.v1.Iterator;

public class Client {
    public static void main(String[] args) {
        PayManager payManager = new PayManager();
        payManager.calcPay();
        System.out.println("集团工资列表：");
        test(payManager.createIterator());

        SalaryManager salaryManager = new SalaryManager();
        salaryManager.calcSalary();
        System.out.println("新公司公司列表：");
        test(salaryManager.createIterator());
    }

    public static void test(Iterator it) {
        it.first();
        while (!it.isDone()) {
            Object obj = it.currentItem();
            System.out.println(String.format("obj==%s", obj));
            it.next();
        }
    }
}
